<h1><?php echo $title;?></h1>
<br>
<p><?php echo anchor("cresource/create", '<button class="btn" type="button">Add new Resource</button>');?></p>
<br>
<?php
if ($this->session->flashdata('message')){
	echo "<div class='message'>".$this->session->flashdata('message')."</div>";
}

if (count($resources)){
	echo '<table cellpadding="0" cellspacing="0" border="0" class="bordered-table zebra-striped" id="example">';
	echo "<thead>\n<tr valign='top'>\n";
	echo "<th>No</th>\n<th>Resource type</th><th style='width:200px;'>Image</th><th>Semester</th><th>Shift</th><th>Group</th><th>Year</th><th>Course</th><th>Actions</th>\n";
	echo "</tr>\n</thead>\n<tbody>\n";
	$i = 1;
	foreach ($resources as $key => $list){
		echo "<tr valign='top'>\n";
		echo "<td align='center'>".$i++."</td>\n";
		echo "<td align='center'>".$list['file_type']."</td>\n";
		echo "<td align='center'>";
		$extension = pathinfo($list['file_src'], PATHINFO_EXTENSION);
		if (strtolower($extension)=='gif' || strtolower($extension)=='jpg' || strtolower($extension)=='png') {
			echo "<img title='view image' class='img-popup' style='style:width:80px; height:80px;'  src=".base_url().'images/'.$_SESSION['username'].'/'.$list['file_src']." />";			
		}
		elseif (strtolower($extension)=='flv' || strtolower($extension)=='mp4' || strtolower($extension)=='dat' || strtolower($extension)=='avi' || strtolower($extension)=='wmv' ){
			echo "<a target='_blank' href=".base_url().'images/'.$_SESSION['username'].'/'.$list['file_src'].">".$list['file_src']."</a>";
			/*echo '<video width="320" height="240" controls>';
			echo '<source src="'.base_url().'images/'.$_SESSION['username'].'/'.$list['file_src'].'" type="video/"'.strtolower($extension).'">';
  			echo '<source src="movie.ogg" type="video/ogg">';
			echo 'Your browser does not support the video tag.';
			echo '</video>';*/
		}
		else{
			echo "<a href=".base_url().'images/'.$_SESSION['username'].'/'.$list['file_src'] .">".$list['file_src']."</a>";
		} 
		echo "</td>\n";
		echo "<td align='center'>".$list['semester']."</td>\n";
		echo "<td align='center'>".$list['shift']."</td>\n";
		echo "<td align='center'>".$list['group']."</td>\n";
		//echo "<td align='center'>".$list['batch']."</td>\n";
		echo "<td align='center'>".$list['year']."</td>\n";
		echo "<td align='center'>".$list['course']."</td>\n";
		if($list['activate']==1) 
			$activate = 'active';
		else 
			$activate = 'inactive';
			
		//echo "<td align='center'>". $activate."</td>\n";
		echo "<td align='center'>";
		echo anchor('cresource/edit/'.$list['file_id'],'edit');
		echo " | ";
		echo anchor('cresource/delete/'.$list['file_id'],'delete',array('class'=>'delete-item'));
		echo "</td>\n";
		echo "</tr>\n";
	}
	echo "</tbody>\n</table>";
}
?>